package cn.wolfcode.crm.web.controller;

import cn.wolfcode.crm.domain.Loss;
import cn.wolfcode.crm.page.PageResult;
import cn.wolfcode.crm.query.LossQueryObject;
import cn.wolfcode.crm.query.QueryObject;
import cn.wolfcode.crm.service.ILossService;
import cn.wolfcode.crm.util.PermissionName;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("loss")
public class LossController {

    @Autowired
    private ILossService lossService;

    @RequestMapping("")
    @RequiresPermissions("loss:index")
    @PermissionName("事故明细列表")
    public String index() {
        //只负责跳转到loss.jsp页面即可
        return "loss";
    }
    @RequestMapping("list")
    @RequiresPermissions("loss:list")
    @PermissionName("事故明细数据")
    @ResponseBody
    public PageResult list(LossQueryObject qo) {
        PageResult result=lossService.query(qo);
        return result;
    }

}